package com.cn.web.user.vo.company;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cn.annoation.UnitChange;
import com.cn.annoation.UnitChangeType;
import com.cn.common.IDGenerate;
import com.cn.devison.Devision2Util;
import com.cn.dic.annoations.DicAnnoations;
import com.cn.dic.serialize.DicSerialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * description: UserCompanyDO <br>
 * date: 23.7.18 8:50 <br>
 * author: cn_yaojin <br>
 * version: 1.0 <br>
 */
@Setter
@Getter
@Accessors(chain = true)
@ApiModel(value = "供应商信息")
@TableName(value = "sys_user_company")
public class UserCompanyDO extends IDGenerate {

    @ExcelIgnore
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "所属账号ID")
    private Long userId;

    @ExcelProperty(value = "企业名称")
    @UnitChange
    @ApiModelProperty(value = "企业名称")
    private String companyName;

    @ExcelProperty(value = "统一社会信用代码")
    @UnitChange
    @ApiModelProperty(value = "统一社会信用代码")
    private String companyNo;

    @ExcelIgnore
    @UnitChange
    @ApiModelProperty(value = "企业logo")
    private String companyLogo;

    @ExcelProperty(value = "企业简介")
    @UnitChange
    @ApiModelProperty(value = "企业简介")
    private String companyDesc;

    @ExcelProperty(value = "企业邮箱")
    @UnitChange
    @ApiModelProperty(value = "企业邮箱")
    private String email;

    @ExcelIgnore
    @UnitChange(type = UnitChangeType.number)
    @DicAnnoations(dicType = "companyType", split = ",")
    @ApiModelProperty(value = "组织类型")
    private String companyType;

    @ExcelProperty(value = "组织类型")
    @TableField(exist = false)
    @DicAnnoations(dicType = "companyType")
    @JsonSerialize(using = DicSerialize.class)
    @ApiModelProperty(value = "组织类型字典项")
    private String companyTypeTxt;

    @ExcelProperty(value = "联系人名")
    @UnitChange
    @ApiModelProperty(value = "联系人名称")
    private String contactName;

    @ExcelProperty(value = "联系人电话")
    @UnitChange
    @ApiModelProperty(value = "联系人电话")
    private String contactTel;

    @ExcelProperty(value = "成立日期")
    @UnitChange
    @ApiModelProperty(value = "成立日期")
    private String buildTime;

    @ExcelProperty(value = "营业期限")
    @UnitChange
    @ApiModelProperty(value = "营业期限")
    private String businessTerm;

    @UnitChange
    @ExcelProperty(value = "主营产品")
    @ApiModelProperty(value = "主营产品")
    private String businessProduct;

    @ExcelProperty(value = "经营范围")
    @UnitChange
    @ApiModelProperty(value = "经营范围")
    private String businessScope;

    @ExcelProperty(value = "法人姓名")
    @UnitChange
    @ApiModelProperty(value = "法人姓名")
    private String legalName;

    @ExcelProperty(value = "法人电话")
    @UnitChange
    @ApiModelProperty(value = "法人电话")
    private String legalTel;

    @ExcelProperty(value = "法人身份证号")
    @UnitChange
    @ApiModelProperty(value = "法人身份证号")
    private String legalNo;

    @ExcelIgnore
    @UnitChange
    @ApiModelProperty(value = "法人身份证正反面图")
    private String legalNoImg;

    @ExcelIgnore
    @UnitChange
    @ApiModelProperty(value = "营业执照图")
    private String businessImg;

    @ExcelIgnore
    @UnitChange
    @ApiModelProperty(value = "开户许可证")
    private String bankCardImg;

    @ExcelIgnore
    @UnitChange(type = UnitChangeType.area)
    @ApiModelProperty(value = "注册地址，省市县编码")
    private String registerCityAddress;


    @ExcelIgnore
    @TableField(exist = false)
    @ApiModelProperty(value = "注册地址，省市县名称")
    private String registerCityAddressTxt;

    @ExcelProperty(value = "注册地址")
    @UnitChange
    @ApiModelProperty(value = "详细地址")
    private String registerStreetAddress;

    @ExcelProperty(value = "注册资金")
    @UnitChange
    @ApiModelProperty(value = "注册资金")
    private String registerMoney;

    @ExcelIgnore
    @ApiModelProperty(value = "0-正常 10-拉黑 20-注销 100-删除")
    private Integer companyStatus;

    @ExcelProperty(value = "入驻时间")
    @ApiModelProperty(value = "添加时间")
    private String addTime;

    @ExcelProperty(value = "注销时间")
    @ApiModelProperty(value = "注销时间")
    private String logoutTime;

    @ExcelProperty(value = "备注")
    private String remark;

    @TableField(exist = false)
    @ExcelIgnore
    @ApiModelProperty(value = "入驻类型")
    private String userItemTypeTxt;

    public String getCompanyTypeTxt() {
        return companyType;
    }

    public String getRegisterCityAddressTxt() {
        return Devision2Util.getTxt(registerCityAddress);
    }
}
